import React, { Component } from "react";
import { Platform, StyleSheet, Text, View } from "react-native";
import { SafeAreaView } from "react-navigation";
import ViewUtils from "../utils/ViewUtils";
import NavigationBar from "./common/NavigationBar";
import { displayName as appName } from "../../app.json";
import { commonStyles } from "../configs/commonStyle";
import { isIOS } from "../configs/platform";
import { navigator } from "../utils";


export default class NetErrorTipPage extends Component {
    render() {

        return (
            <SafeAreaView style={commonStyles.body}>
                <View style={styles.container}>
                    <NavigationBar
                        title={'解决方案'}
                        leftButton={ViewUtils.getLeftButton(() => this._onBackPress())}/>
                    <View style={{marginTop: 15, marginRight: 20, marginLeft: 20}}>
                        <Text style={{color: '#333333', fontSize: 14}}>{isIOS()?'1.':''}检查本地网络状况</Text>
                        <Text style={{color: '#666666', fontSize: 14}}>请查看你本地的无线网络或手机信号情况，信号差的时 候也无法正常获取信息</Text>
                        {
                            Platform.OS === 'ios' ? <View>
                                <Text style={{color: '#333333', fontSize: 14, marginTop: 24}}>2.检查网络权限状况</Text>
                                <Text style={{color: '#666666', fontSize: 14}}>请打开【设置】-【蜂窝移动网络】，找到【{appName}】
                                    ，开启【蜂窝移动数据】即可。</Text>
                                <Text style={{color: '#666666', fontSize: 14, marginTop: 12}}>如果未找到【{appName}】，请重启手机，打开{appName}APP后，再进入【设置】中尝试。</Text>
                            </View> : null
                        }
                    </View>
                </View>
            </SafeAreaView>
        );
    }

    _onBackPress() {
      navigator.goBack()
    }

}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: 'white',
    },
});
